<?php
class admin
{
	var $table;
	var $db;
	var $where=1;
	
	function __construct()
	{
		global $db;
		$this->db=$db;
	}
	
	function get_all()
	{
		return $this->db->getlist("select * from ".$this->table." where ".$this->where);
	}
	
	function get_one($id)
	{
		return $this->db->getone("select * from ".$this->table." where id='$id' and ".$this->where);
	}
	
	function del_one($id)
	{
		$this->db->update($this->table,array("status"=>9)," id=$id ");
	}
	
	function block($id)
	{
		$this->db->update($this->table,array("status"=>8)," id=$id and ".$this->where);
	}
	
	function add($array)
	{
		$this->db->insert($this->table,$array);
	}
	
	function check($where=1)
	{
		$r=$this->db->getone("select * from ".$this->table." where $where");
		if(!$r)	return true;
		return false;
	}
	
	function unblock($id)
	{
		$this->db->update($this->table,array("status"=>1)," id=$id and ".$this->where);
	}
	
	function update($array,$where)
	{
		$this->db->update($this->table,$array,$where);
	}
}
?>